<?php
include "../config/koneksi.php";
include "../class/kategori.php";

if (ISSET($_GET["id_kategori"])){
	$id_kategori=$_GET["id_kategori"];
	$kategori_dao = new Kategori_Dao();
	$kategori=$kategori_dao->get($id_kategori);
}

if (ISSET($_POST["edit"])){
	$kategori_dao = new Kategori_Dao();
	$kategori= new Kategori();
	$kategori->id_kategori = $_POST['id_kategori'];
	$kategori->kategori = $_POST['kategori'];
	$kategori_dao->edit($kategori);
	header("Location:view_kategori.php");
}
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
  <tr >
    <td height="30"> 
      <div align="left"><font size="3" face="tahoma">Edit Kategori</font><hr color=#CCCCFF></div></td>
    </tr>
  </table>
<form name="edit" method="post" action="edit_kategori.php">
<input type="hidden" name="edit">
<input type="hidden" name="id_kategori" value="<?php echo $kategori->id_kategori?>">

  <table width="60%" border="0" align="center" bordercolor="#FF9900" bgcolor="#FFFFFF">
    <tr bordercolor="#FFFFFF"> 
      <td><font size="2" face="tahoma">Nama Kategori</font></td>
      <td valign=top>:</td>
      <td valign=top> <input name="kategori" type="text" id="kategori" value='<?php echo $kategori->kategori?>'></td>
    </tr>
    <tr bordercolor="#FFFFFF"> 
      <td height="21" colspan="2"></td><td><font size="2" face="tahoma"> 
          <input type="submit" name="Submit42" value="Simpan">
		  <button type ="button" name="fulang2" value="Batal" class="btn btn-success" onClick="javascript:history.back()">Batal
          </font>
        </td>
    </tr>
  </table>
</form>